package com.scheduling.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.scheduling.common.annotation.Log;
import com.scheduling.common.core.controller.BaseController;
import com.scheduling.common.core.domain.AjaxResult;
import com.scheduling.common.enums.BusinessType;
import com.scheduling.system.domain.Ruleweightmanagement;
import com.scheduling.system.service.IRuleweightmanagementService;
import com.scheduling.common.utils.poi.ExcelUtil;
import com.scheduling.common.core.page.TableDataInfo;

/**
 * 规则权重管理Controller
 * 
 * @author mj
 * @date 2025-05-07
 */
@RestController
@RequestMapping("/system/ruleweightmanagement")
public class RuleweightmanagementController extends BaseController
{
    @Autowired
    private IRuleweightmanagementService ruleweightmanagementService;

    /**
     * 查询规则权重管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:ruleweightmanagement:list')")
    @GetMapping("/list")
    public TableDataInfo list(Ruleweightmanagement ruleweightmanagement)
    {
        startPage();
        List<Ruleweightmanagement> list = ruleweightmanagementService.selectRuleweightmanagementList(ruleweightmanagement);
        return getDataTable(list);
    }

    /**
     * 导出规则权重管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:ruleweightmanagement:export')")
    @Log(title = "规则权重管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Ruleweightmanagement ruleweightmanagement)
    {
        List<Ruleweightmanagement> list = ruleweightmanagementService.selectRuleweightmanagementList(ruleweightmanagement);
        ExcelUtil<Ruleweightmanagement> util = new ExcelUtil<Ruleweightmanagement>(Ruleweightmanagement.class);
        util.exportExcel(response, list, "规则权重管理数据");
    }

    /**
     * 获取规则权重管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:ruleweightmanagement:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(ruleweightmanagementService.selectRuleweightmanagementById(id));
    }

    /**
     * 新增规则权重管理
     */
    @PreAuthorize("@ss.hasPermi('system:ruleweightmanagement:add')")
    @Log(title = "规则权重管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Ruleweightmanagement ruleweightmanagement)
    {
        return toAjax(ruleweightmanagementService.insertRuleweightmanagement(ruleweightmanagement));
    }

    /**
     * 修改规则权重管理
     */
    @PreAuthorize("@ss.hasPermi('system:ruleweightmanagement:edit')")
    @Log(title = "规则权重管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Ruleweightmanagement ruleweightmanagement)
    {
        return toAjax(ruleweightmanagementService.updateRuleweightmanagement(ruleweightmanagement));
    }

    /**
     * 删除规则权重管理
     */
    @PreAuthorize("@ss.hasPermi('system:ruleweightmanagement:remove')")
    @Log(title = "规则权重管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(ruleweightmanagementService.deleteRuleweightmanagementByIds(ids));
    }
}
